package cn.tedu._05mvcboot04.config;

import cn.tedu._05mvcboot04.interceptor.UserLoginInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * SpringMVC拦截器配置类
 */
public class MvcConfig implements WebMvcConfigurer {
    /**
     * 注册拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截发布文章请求
        registry.addInterceptor(new UserLoginInterceptor())
                .addPathPatterns("/v1/users/article");
    }
}
